package org.aphasia4j.service;

import java.util.List;

import org.aphasia4j.model.Model;

/**
 * Interface description for base data related requests.
 * 
 * @author hillger.t
 */
public interface BaseService<D, T extends Model> {

  /**
   * Persists the given object inside the datastore.
   * 
   * @param obj The object to persist.
   */
  public void persist(T obj);

  /**
   * Removes an entity with the given identigier from the datastore.
   * 
   * @param id
   */
  public void remove(long id);

  /**
   * Removes the given entity from the datastore.
   * 
   * @param obj The object to persist.
   */
  public void remove(T obj);

  /**
   * Returns an entity for the given identigier.
   * 
   * @param id
   * @return
   */
  public T get(long id);

  /**
   * Returns a list of entities for the configured generic type.
   */
  public List<T> getAll();
}
